﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GeoFly
{
    /// <summary>
    /// Pristley and Taylor method to calculate PET
    /// </summary>
    public class PETInPristley :PETInPM
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="tav"></param>
        /// <param name="elev"></param>
        /// <param name="yr"></param>
        /// <param name="dn"></param>
        /// <param name="lat">默认为lat=33</param>
        public PETInPristley(double tav, double elev, int yr, int dn, double lat)
            : base(tav, elev, yr, dn, lat)
        {
	        dTavk = dTav + 273.15;
	        pwatvap = new WaterVapor(tav,elev);
        }
        
        public double PETByPristley(double alfa,double G)
        {
            double dret=0;
	        double dNetRad = NetRadiation();			//net radiation
	        double dlta = pwatvap.TmpVapCurveSlp();	//slope of the saturation vapor pressure-temperature curve
	        double gma = pwatvap.PsychroConst();		//psychrometric constant
	        double lmt = pwatvap.LatHeatVapor();		//latent heat of vaporization

	        dret = alfa*dlta*(dNetRad-G)/(dlta+gma);
	        return dret;
        }
        /// <summary>
        /// 同上，只是默认G=0
        /// </summary>
        /// <param name="alfa"></param>
        /// <returns></returns>
        public double PETByPristley(double alfa)
        {
            return this.PETByPristley(alfa,0);
        }

    }
}
